<template>
  <div>
    <div class="page-index book-container">
      <div class="book-content">
        <book-row type="flex" :gutter="10">
          <book-col :span="4">
            <classifiedNavigation title="图书" :learnMore="bookLearnMore" :menuList="bookMenuList"></classifiedNavigation>
            <classifiedNavigation title="艺术品与收藏" :menuList="artworkMenuList"></classifiedNavigation>
            <classifiedNavigation title="文创与周边" :menuList="peripheryMenuList"></classifiedNavigation>
            <fastNavigation></fastNavigation>
            <UBECenter></UBECenter>
            <news></news>
          </book-col>
          <book-col :span="20">
            <bookCarousel height="270px" :carouselList="carouselList"></bookCarousel>
            <exhibition></exhibition>
            <goodBookShare :data="goodBookShareData"></goodBookShare>
            <newBookPlaza :data="newBookData"></newBookPlaza>
          </book-col>
        </book-row>
        <book-row type="flex">
          <activity></activity>
        </book-row>
      </div>
    </div>
    <!-- 旧书 -->
    <classifiedDisplay
      title="旧书"
      :recommend="oldBookOption.recommend"
      :lsideOption="oldBookOption.lside"
      :rsideOption="oldBookOption.rside"
      :bookData="oldBookData"
      :bookStoreData="oldBookStoreData">
    </classifiedDisplay>
    <!-- 新书 -->
    <classifiedDisplay
      title="新书"
      :style="{ background: '#F7F7F6' }"
      :lsideOption="newlyBookOption.lside"
      :rsideOption="newlyBookOption.rside"
      :bookData="newlyBookData"
      :bookStoreData="newlyBookStoreData">
    </classifiedDisplay>
    <!-- 旧籍寻踪 -->
    <classifiedDisplay
      title="旧籍寻踪"
      :recommend="tracingOldBookOption.recommend"
      :lsideOption="tracingOldBookOption.lside"
      :rsideOption="tracingOldBookOption.rside"
      :bookData="tracingOldBookData"
      :bookStoreData="tracingOldBookStoreData">
    </classifiedDisplay>
    <!-- 艺文集览 -->
    <classifiedDisplay
      title="艺文集览"
      :style="{ background: '#F7F7F6' }"
      :recommend="artLiteratureOption.recommend"
      :lsideOption="artLiteratureOption.lside"
      :rsideOption="artLiteratureOption.rside"
      :bookData="tracingOldBookData"
      :bookStoreData="tracingOldBookStoreData">
    </classifiedDisplay>
    <!-- 古籍存览 -->
    <classifiedDisplay
      title="古籍存览"
      :recommend="ancientBooksOption.recommend"
      :lsideOption="ancientBooksOption.lside"
      :rsideOption="ancientBooksOption.rside"
      :bookData="tracingOldBookData"
      :bookStoreData="tracingOldBookStoreData">
    </classifiedDisplay>
    <!-- 民国旧书 -->
    <classifiedDisplay
      title="民国旧书"
      :style="{ background: '#F7F7F6' }"
      :recommend="republicanOption.recommend"
      :lsideOption="republicanOption.lside"
      :rsideOption="republicanOption.rside"
      :bookData="tracingOldBookData"
      :bookStoreData="tracingOldBookStoreData">
    </classifiedDisplay>
    <!-- 古籍拍卖 -->
    <classifiedDisplay
      title="古籍拍卖"
      :lsideOption="ancientBooks.lside"
      :rsideOption="ancientBooks.rside"
      :bookData="tracingOldBookData"
      :bookStoreData="tracingOldBookStoreData">
    </classifiedDisplay>
    <!-- 民国书刊拍卖 -->
    <classifiedDisplay
      title="民国书刊拍卖"
      :style="{ background: '#F7F7F6' }"
      :recommend="periodicalsOption.recommend"
      :lsideOption="periodicalsOption.lside"
      :rsideOption="periodicalsOption.rside"
      :bookData="tracingOldBookData"
      :bookStoreData="tracingOldBookStoreData">
    </classifiedDisplay>
    <!-- 艺术品拍卖 -->
    <classifiedDisplay
      title="艺术品拍卖"
      :recommend="artAuctionOption.recommend"
      :lsideOption="artAuctionOption.lside"
      :rsideOption="artAuctionOption.rside"
      :bookData="tracingOldBookData"
      :bookStoreData="tracingOldBookStoreData">
    </classifiedDisplay>
    <div class="book-content">
      <auctionCompanyAlliance></auctionCompanyAlliance>
    </div>
  </div>
</template>

<script>
import classifiedNavigation from './components/classifiedNavigation'
import exhibition from './components/exhibition'
import goodBookShare from './components/goodBookShare'
import newBookPlaza from './components/newBookPlaza'
import fastNavigation from './components/fastNavigation'
import UBECenter from './components/UBECenter'
import news from './components/news'
import activity from './components/activity'
import bookCarousel from '@/components/carousel/index'
import classifiedDisplay from './components/classifiedDisplay'
import auctionCompanyAlliance from './components/auctionCompanyAlliance'
import {
  getBookMenuList,
  getArtworkMenuList,
  getPeripheryMenuList
} from '@/api/menu/index'

import {
  getCarouselList,
  getGoodBookShareData,
  getNewBookData,
  getOldBookData,
  getOldBookStoreData,
  getNewlyBookData,
  getNewlyBookStoreData,
  getTracingOldBookData,
  getTracingOldBookStoreData
} from '@/api/home/index'

export default {
  name: 'homeIndex',
  components: {
    classifiedNavigation,
    bookCarousel,
    exhibition,
    goodBookShare,
    newBookPlaza,
    fastNavigation,
    UBECenter,
    news,
    activity,
    classifiedDisplay,
    auctionCompanyAlliance
  },
  data () {
    return {
      bookLearnMore: {
        title: '最新上书'
      },
      bookMenuList: [],
      artworkMenuList: [],
      carouselList: [],
      peripheryMenuList: [],
      goodBookShareData: [],
      newBookData: [],
      oldBookData: [],
      oldBookStoreData: [],
      newlyBookData: [],
      newlyBookStoreData: [],
      oldBookOption: {
        recommend: [
          { title: '四部丛刊', path: '#' },
          { title: '商务印书管', path: '#' },
          { title: '珂罗版', path: '#' },
          { title: '梁启超', path: '#' },
          { title: '十三经清人注', path: '#' },
          { title: '中华书局', path: '#' },
          { title: '唐诗三百首', path: '#' },
          { title: '经眼录', path: '#' },
          { title: '胡适文集', path: '#' }
        ],
        lside: {
          title: '国学经典',
          learnMore: true
        },
        rside: {
          title: '书店推荐'
        }
      },
      newlyBookOption: {
        lside: {
          title: '新近出版',
          learnMore: true
        },
        rside: {
          title: '新书销售排行榜',
          learnMore: true
        }
      },
      tracingOldBookData: [],
      tracingOldBookStoreData: [],
      tracingOldBookOption: {
        recommend: [
          { title: '古本小说集成', path: '#' },
          { title: '耿世民旧藏', path: '#' },
          { title: '文史旧书', path: '#' },
          { title: '四部丛刊', path: '#' },
          { title: '印谱', path: '#' },
          { title: '张政烺藏书', path: '#' },
          { title: '地方志集成', path: '#' }
        ],
        lside: {
          title: '史籍掇英',
          learnMore: true
        },
        rside: {
          title: '书店推荐'
        }
      },
      artLiteratureOption: {
        recommend: [
          { title: '人民美术', path: '#' },
          { title: '鲁迅全集', path: '#' },
          { title: '巴金', path: '#' }
        ],
        lside: {
          title: '旧书精选',
          learnMore: true
        },
        rside: {
          title: '书店推荐'
        }
      },
      ancientBooksOption: {
        recommend: [
          { title: '明版', path: '#' },
          { title: '汲古阁', path: '#' },
          { title: '武英殿版', path: '#' },
          { title: '钦定四库全书', path: '#' },
          { title: '经部', path: '#' },
          { title: '乐类', path: '#' },
          { title: '绣像三国志', path: '#' },
          { title: '诗集', path: '#' },
          { title: '木刻', path: '#' },
          { title: '芥子园画谱', path: '#' }
        ],
        lside: {
          title: '经籍宝卷',
          learnMore: true
        },
        rside: {
          title: '书店推荐'
        }
      },
      republicanOption: {
        recommend: [
          { title: '王云五', path: '#' },
          { title: '巴金', path: '#' },
          { title: '郑振铎', path: '#' },
          { title: '商务印书馆', path: '#' },
          { title: '东北书店', path: '#' },
          { title: '鲁迅先生', path: '#' },
          { title: '上海中华书局', path: '#' }
        ],
        lside: {
          title: '百年拾遗',
          learnMore: true
        },
        rside: {
          title: '书店推荐'
        }
      },
      periodicalsOption: {
        recommend: [
          { title: '沫沫小姐', path: '#' },
          { title: '雨田先生', path: '#' },
          { title: '知我不足', path: '#' },
          { title: '孔网代买代卖中心民国书专卖', path: '#' }
        ],
        lside: {
          title: '古籍珍本',
          learnMore: true
        },
        rside: {
          title: '书店推荐'
        }
      },
      ancientBooks: {
        lside: {
          title: '古籍珍本',
          learnMore: true
        },
        rside: {
          title: '书店推荐'
        }
      },
      artAuctionOption: {
        recommend: [
          { title: '名人墨迹', path: '#' },
          { title: '名人字画', path: '#' },
          { title: '连环画', path: '#' },
          { title: '版画宣传画', path: '#' },
          { title: '邮票税票', path: '#' },
          { title: '钱币', path: '#' },
          { title: '碑帖印谱', path: '#' },
          { title: '照片影像', path: '#' },
          { title: '古玩杂项', path: '#' }
        ],
        lside: {
          title: '拍品精选',
          learnMore: true
        },
        rside: {
          title: '拍品精选',
          learnMore: true
        }
      }
    }
  },
  methods: {
    getBookMenuList () {
      getBookMenuList().then(({ data }) => {
        this.bookMenuList = data.data
      })
    },
    getArtworkMenuList () {
      getArtworkMenuList().then(({ data }) => {
        this.artworkMenuList = data.data
      })
    },
    getPeripheryMenuList () {
      getPeripheryMenuList().then(({ data }) => {
        this.peripheryMenuList = data.data
      })
    },
    getCarouselList () {
      getCarouselList().then(({ data }) => {
        this.carouselList = data.data
      })
    },
    getGoodBookShareData () {
      getGoodBookShareData().then(({ data }) => {
        this.goodBookShareData = data.data
      })
    },
    getNewBookData () {
      getNewBookData().then(({ data }) => {
        this.newBookData = data.data
      })
    },
    getOldBookData () {
      getOldBookData().then(({ data }) => {
        this.oldBookData = data.data
      })
    },
    getNewlyBookData () {
      getNewlyBookData().then(({ data }) => {
        this.newlyBookData = data.data
      })
    },
    getOldBookStoreData () {
      getOldBookStoreData().then(({ data }) => {
        this.oldBookStoreData = data.data
      })
    },
    getNewlyBookStoreData () {
      getNewlyBookStoreData().then(({ data }) => {
        this.newlyBookStoreData = data.data
      })
    },
    getTracingOldBookData () {
      getTracingOldBookData().then(({ data }) => {
        this.tracingOldBookData = data.data
      })
    },
    getTracingOldBookStoreData () {
      getTracingOldBookStoreData().then(({ data }) => {
        this.tracingOldBookStoreData = data.data
      })
    },
    pageInit () {
      this.getBookMenuList()
      this.getArtworkMenuList()
      this.getCarouselList()
      this.getPeripheryMenuList()
      this.getGoodBookShareData()
      this.getNewBookData()
      this.getOldBookData()
      this.getNewlyBookData()
      this.getOldBookStoreData()
      this.getNewlyBookStoreData()
      this.getTracingOldBookData()
      this.getTracingOldBookStoreData()
    }
  },
  created () {
    this.pageInit()
  }
}
</script>

<style lang="scss" scoped>
  .page-index {
    background: #F7F7F6;
  }
</style>
